package defaultPackage;
import java.awt.*;


public class Resources 
{
	static int resources = 0, countDown = 0;
	static boolean notEnough = false;
	
	public static void draw(Graphics g)
	{
		g.setColor(Color.DARK_GRAY);
		g.fillRect(MainClass.windowXSize - 195, 10, 190, 40);
		if (notEnough == false)
		{
			g.setColor(Color.cyan);
		}
		else if (notEnough == true)
		{
			g.setColor(Color.red);
		}
		g.drawString("Resources: " + resources, MainClass.windowXSize - 190, 40);
	}
	
	public static void setResources(int resources)
	{
		Resources.resources = resources;
	}
	
	public static int getResources()
	{
		return resources;
	}
	
	public static void setRed()
	{
		notEnough = true;
		countDown = 20;
	}
	
	public static void setBlue()
	{
		notEnough = false;
	}
	
	public static void redCount()
	{
		if (notEnough == true && countDown > 0)
		{
			countDown -= 1;
		}
		else
			setBlue();
	}
	
	public static void addResources()
	{
		setResources(getResources() + ((int)(Math.random() * 50)));
	}
	
	public static void resourceChance()
	{
		if (Math.random() >= .995)
			addResources();
	}
}
